From: Eli Zaretskii Date: Sun, 12 Jan 2025 06:22:24 +0000 (+0200) Subject: Fix mouse-2 clicks on mode line and header line X-Git-Tag: archive/raspbian/1%30.2+1-2+rpi1^2~2^2~24^2~256 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/success/%22http:/www.example.com/cgi/success?a=commitdiff_plain;h=b3181a807124d5c6226fdcf1e42bf4b6fcdc4ad2;p=emacs.git Fix mouse-2 clicks on mode line and header line * src/keymap.c (Fcurrent_active_maps): For clicks on mode-line and header-line, always override the keymaps at buffer position. (Bug#75219) (cherry picked from commit c41ea047a434710c4b7bc8280695c83fbe5fff35) --- diff --git a/src/keymap.c b/src/keymap.c index 720eb5c32a4..634c4e33bbd 100644 --- a/src/keymap.c +++ b/src/keymap.c @@ -1740,17 +1740,27 @@ like in the respective argument of `key-binding'. */) if (CONSP (string) && STRINGP (XCAR (string))) { Lisp_Object pos = XCDR (string); + Lisp_Object pos_area = POSN_POSN (position); string = XCAR (string); if (FIXNUMP (pos) && XFIXNUM (pos) >= 0 && XFIXNUM (pos) < SCHARS (string)) { - Lisp_Object map = Fget_text_property (pos, Qlocal_map, string); - if (!NILP (map)) + Lisp_Object map = Fget_text_property (pos, Qlocal_map, + string); + /* For clicks on mode line or header line, override + the maps we found at POSITION unconditionally, even + if the corresponding properties of the mode- or + header-line string are nil, because propertries at + point are not relevant in that case. */ + if (!NILP (map) + || EQ (pos_area, Qmode_line) + || EQ (pos_area, Qheader_line)) local_map = map; - map = Fget_text_property (pos, Qkeymap, string); - if (!NILP (map)) + if (!NILP (map) + || EQ (pos_area, Qmode_line) + || EQ (pos_area, Qheader_line)) keymap = map; } }